package com.itheima.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.itheima.dto.OrderDTO;
import com.itheima.pojo.Order;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

public interface OrderMapper extends BaseMapper<Order> {

    @Select("select m.name as member,\n" +
            "s.name as setmeal,\n" +
            "date_format(o.order_date,'%Y-%m-%d') as order_date,\n" +
            "o.order_type  as order_type\n" +
            "from tb_order o\n" +
            "left join tb_member m on  o.member_id=m.id \n" +
            "left join tb_setmeal s on s.id=o.setmeal_id\n" +
            "where o.id=#{orderId} ")
    public OrderDTO successOrder(@Param("orderId")Long orderId);
}
